// 导入模块
const mongoose = require('mongoose');
// 创建数据库连接对象
const db = mongoose.createConnection('mongodb://admin:123456@localhost:27017/study?authSource=admin', {
  useNewUrlParser: true,
  useUnifiedTopology: true
}, err => {
  if (err) {
    console.log(('---------------------------'));
    console.log("数据库连接失败：", err);
    console.log(('---------------------------'));
    return;
  }
  console.log('数据库连接成功！');
})

//导出数据库实例对象
module.exports = db;
